package com.xieman.controller;

import com.xieman.anti.replay.annotation.XMAntiReplay;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
public class DemoController {
    @Autowired
    private RedisTemplate redisTemplate;

    @XMAntiReplay
    @GetMapping("/test")
    public String test(String username,String password){

//        Object abc = redisTemplate.opsForValue().get("abc");
        redisTemplate.opsForValue().set("hahha","dahusdhuais");
        this.redisTemplate.opsForValue().increment("ssss", 3);
        return "hello";
    }

    @XMAntiReplay
    @PostMapping("/tes2")
    public String test2(@RequestParam String username,String password){
        redisTemplate.opsForValue().set("hahha","dahusdhuais");
        this.redisTemplate.opsForValue().increment("ssss", 3);
        return "hello";
    }
}
